package xyj.sparrow.scheduler.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import xyj.sparrow.scheduler.common.Result;

/**
 * 全局异常处理
 *
 * @author 江南小俊
 * @since 2021/6/13 下午9:26
 **/
@Slf4j
@ControllerAdvice
public class CusExceptionHandler {
    @ExceptionHandler
    @ResponseBody
    public Result<Object> exceptionHandler(Exception e) {
        log.error("",e);
        return Result.error(e.getMessage());
    }
}
